package com.nextcloud.hello.web.controller;

import com.nextcloud.hello.web.response.AmisResponse;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/amis/test")
public class AmisTestController {

    @GetMapping("/table-data")
    public AmisResponse<List<Map<String, Object>>> getTableData() {
        List<Map<String, Object>> tableData = mockTableData();
        return AmisResponse.success(tableData);
    }

    private List<Map<String, Object>> mockTableData() {
        List<Map<String, Object>> data = new ArrayList<>();
        for (int i = 1; i <= 10; i++) {
            Map<String, Object> row = new HashMap<>();
            row.put("id", i);
            row.put("name", "Item " + i);
            row.put("price", (i * 10.0));
            data.add(row);
        }
        return data;
    }
}